

"""英雄基类"""
class Hero:
        #英雄名称
        hero_name =''
        #英雄血量
        hero_hp = 0
        #英雄攻击力
        hero_power = 0


        def fight(self,enemy_hp,enemy_power,enemy_name):
            """
            :param enemy_hp: 敌人的血量
            :param enemy_power: 敌人的攻击力
            :param enemy_name: 敌人名称
            :return:
            """
            #计算英雄最终血量
            hero_final_hp = self.hero_hp - enemy_power
            #计算敌人最终血量
            enemy_final_hp = enemy_hp - self.hero_power
            if  hero_final_hp > enemy_final_hp:
                print(f"{self.hero_name}获胜")
            elif hero_final_hp < enemy_final_hp:
                print(f"{enemy_name}获胜")
            else:
                print(f"{self.hero_name}{enemy_name}平局")


